package com.linsen.erp.admin.provider.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

//员工状态
@Getter
@AllArgsConstructor
public enum EmploymentStatusEnum {
    EXERCITATION(1,"实习"),
    FORMAL(2,"正式"),
    LEFT(3,"已离职"),
    PARTTIME(4,"兼职"),
    ;

    @JsonValue
    private final Integer value;
    private final String desc;

    private static final Map<Integer, EmploymentStatusEnum> VALUES = new HashMap<>();

    static {
        for (final EmploymentStatusEnum employmentTypeEnum : EmploymentStatusEnum.values()) {
            EmploymentStatusEnum.VALUES.put(employmentTypeEnum.getValue(), employmentTypeEnum);
        }
    }

    @JsonCreator
    public static EmploymentStatusEnum getByValue(Integer value) {
        return EmploymentStatusEnum.VALUES.get(value);
    }
}